upload.cgi

Last update: June 2013

upload.cgi is used to change the contents of the SD card over a network.

How to upload #1 -Upload from web browser-

  1. Write UPLOAD=1 in the CONFIG file
  2. Restart the FlashAir
  3. Connect to the FlashAir via Wireless LAN
  4. Open http://flashair/upload.cgi in web browser
  5. Choose the file to upload and click the "Submit" button

How to upload #2 -Upload with CGI-

  1. Write UPLOAD=1 in the CONFIG file
  2. Restart the FlashAir
  3. Connect to the FlashAir via Wireless LAN
  4. Restrict the write ability of host devices using the WRITEPROTECT command
  5. Set the directory to upload to using the UPDIR command
  6. Set the file creation date using the FTIME command
  7. POST file to upload.cgi and upload file
Function Parameter Example Firmware Version
Upload file http://flashair/upload.cgi 1.00.00+
Delete file http://flashair/upload.cgi?DEL=/DCIM/100__TSB/DSC_100.JPG 1.00.00+
Set upload directory http://flashair/upload.cgi?UPDIR=/DCIM/101__TSB 1.00.00+
Set system time http://flashair/upload.cgi?FTIME=0x00210000 1.00.00+
Restrict the write ability of host devices http://flashair/upload.cgi?WRITEPROTECT=ON 1.00.00+

Upload a file

Send data in multipart/form-data format by POST request, then the file will be uploaded to the directory specified by UPDIR.
If you send a GET request to this URL from a web browser, an upload screen will be displayed.

Returns SUCCESS if successful, ERROR on failure.

Request Example:

http://flashair/upload.cgi

Delete a file

Delete a file from the FlashAir

Important  If you delete a directory, be sure that it does not contain child directories or files. If you delete a parent directory, its child directories and files may no longer be recognized by the file system.

Returns SUCCESS if successful, ERROR on failure.

Request Example:

http://flashair/upload.cgi?DEL=/DCIM/100__TSB/DSC_100.JPG

Set Upload Directory

Set the directory to store the uploaded file. By default, uploads are stored in the root directory (/).

If there is no such directory, the directory will be created.
However, if the supplied parent directory does not exist, the directory will not be created and the uploading operation will fail.

Returns only SUCCESS.
Note that SUCCESS is returned even if the upload operation fails. For this reason, the best practice is to check if the file has been uploaded after using this command.

Request Example:

http://flashair/upload.cgi?UPDIR=/DCIM/101__TSB

Set the system time

Set the creation time of uploaded file. The original creation time will be overwritten.

The parameter consists of a 32bit hexadecimal number. The upper 16bits are for the date, and the lower 16bits are for the time. For detailed information, refer to the FAT32 standard.

Returns SUCCESS if successful, ERROR on failure.

Request Example:

http://flashair/upload.cgi?FTIME=0x00210000

Restrict the write ability of host devices

Restricts host devices from writing to the SD card.
After restricting the write ability, this returns an error if the host device attempts to perform a write operation, so the host device will recognize that the card is in abnormal condition.

To cancel the write restriction, restart the card.

Returns SUCCESS if successful, ERROR on failure.

Request Example:

http://flashair/upload.cgi?WRITEPROTECT=ON